package com.htcms.listener;

import javax.servlet.ServletContextEvent;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class SpringContextLoaderListener extends ContextLoaderListener {
    public static ApplicationContext applicationContext=null;

    @Override
	public void contextInitialized(ServletContextEvent event) {
		super.contextInitialized(event);
		applicationContext = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());	
 
	}
    
    public static Object getBean(String beanName){
    	return applicationContext.getBean(beanName);
    }
}
